import copy
from typing import Dict


class UrlsFiled:

    def __init__(self, url, method, headers=None, description=None, uri=None):
        self.url = url
        self.description = description
        self.method = method
        self.uri = uri
        self.headers = headers or {}

    def __repr__(self):
        return ('Field('
                f'url={self.url!r},'
                f'method={self.method!r},'
                ')')

    def get_urls(self):
        return self.url

    def get_method(self):
        return self.method

    def get_headers(self, **kwargs) -> Dict[str, str]:
        headers = copy.deepcopy(self.headers)
        headers.update(kwargs)
        return headers

    def set_urls(self, url):
        self.url = url

    def set_method(self, method):
        self.method = method

    @property
    def to_dict(self):
        return {
            'url': self.url,
            'method': self.method.upper(),
            'description': self.description,
            'headers': self.headers
        }
